package com.nnfe.fyd.feature.login;

import android.app.Activity;
import android.content.Intent;
import android.support.v4.app.Fragment;

import com.nnfe.fyd.base.BaseActivity;

/**
 * ----------------------------------
 * Created by xyd on 2017/3/15.
 * <p/>
 * 描  述：
 * <p/>
 * 修订历史:
 * ----------------------------------
 */

public class LoginActivity extends BaseActivity {

    public static final String TYPE = "type";
    public static final int TYPE_LOGIN = 0X00000001;
    public static final int TYPE_REGISTER = 0X00000002;
    public static final int TYPE_CHANGE_PSD = 0X00000003;

    /**
     * @param context
     * @param type
     */
    public static void lauch(Activity context, int type) {
        Intent intent = new Intent();
        intent.setClass(context, LoginActivity.class);
        intent.putExtra(TYPE, type);
        context.startActivity(intent);
    }

    @Override
    public Fragment getContentFragment() {
        Fragment fragment;
        switch (getIntent().getIntExtra(TYPE, 0)) {
            case TYPE_LOGIN:
                fragment = new LoginFragment();
                break;
            case TYPE_REGISTER:
                fragment = new RegisterFragment();
                break;
            case TYPE_CHANGE_PSD:
                fragment = new ResetPwdFragment();
                break;
        }
        return new LoginFragment();
    }

    @Override
    public void onBackPressed() {
        super.onBackPressed();
    }
}
